﻿import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
import QtQuick.Controls.Styles 1.4
import paintline 1.0
import report 1.0
//import QtQuick.Controls 2.2
Rectangle{
    width: 1280
    height: 775
    color:"cadetblue";
    //Header{id:head}
    Rectangle{
        id:upper;
        x:0;y:0;
        width: 1280; height: 150;
        color:"cadetblue";
        border.color: "yellow";
        border.width: 1;
        Rectangle{
            id:upperleft;
            x:20;y:45;
            width: 200; height: 60;
            color:"cadetblue";
            border.color: "black";
            border.width: 2;
            Text{
                text:"历 史 数 据";
                anchors.centerIn: parent;
                color: "yellow";
                font.family: "Ubuntu";
                font.pixelSize: 30;
            }
        }
        Rectangle{
            id:uppermid;
            x:350;y:10;
            width: 600; height: 100;
            color:"cadetblue";
            Text{
                text:"系统状态";
                color:"yellow";
                font.family: "Ubuntu"
                font.pixelSize: 20
                y:3;
                anchors.horizontalCenter: parent.horizontalCenter;
            }
            Rectangle{
                y:30;anchors.horizontalCenter: parent.horizontalCenter;
                width: 500; height: 30;
                color:"cadetblue";
                Text{
                    text:"1#锅炉";
                    x:10;y:10;
                    font.family: "Ubuntu"
                    font.pixelSize: 15
                    color:"yellow";
                }
                Rectangle{
                    x:70;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
                Rectangle{
                    x:215;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
                Rectangle{
                    x:360;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
            }
            Rectangle{
                y:65;anchors.horizontalCenter: parent.horizontalCenter;
                width: 500; height: 30;
                color:"cadetblue";
                Text{
                    text:"1#锅炉";
                    x:10;y:10;
                    font.family: "Ubuntu"
                    font.pixelSize: 15
                    color:"yellow";
                }
                Rectangle{
                    x:70;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
                Rectangle{
                    x:215;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
                Rectangle{
                    x:360;y:5;
                    width: 130; height: 20;
                    color:"#CCEEFF";
                }
            }
        }
        Rectangle{
            id:upperright;
            x:1025;y:35;
            width: 200; height: 50;
            color:"black";
            Timer {
                interval: 500; running: true; repeat: true
                onTriggered: historytime.text = Qt.formatDateTime(new Date(),
                                        "yyyy-MM-dd hh:mm:ss")
            }
            Text{
                id:historytime
                anchors.centerIn: parent;
                color: "yellow"
                font.family: "Ubuntu"
                font.pixelSize: 15
            }
        }
    }
    Rectangle{
        id:bottom;
        x:0;y:125;
        width: 1280; height: 650;
        color:"cadetblue";
        Rectangle{
            anchors.centerIn: parent;
            width: 900; height: 630;
            color:"cadetblue";
            Rectangle{
                x:0;y:0;
                width: 900; height: 315;
                color:"cadetblue";
                Rectangle{
                    x:0;y:0;
                    width: 445; height: 315;
                    color:"cadetblue";
                    border.color: "black";
                    border.width: 1;
                    Text{
                        id:tes;
                        text:"1#锅炉";
                        x:120;y:15;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 20
                    }
                    Text{
                        text:"历史曲线";
                        y:tes.y+25;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes.y+65;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 160; height: 40;
                        Text{
                            text:"历史曲线查询"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked: {
                                //head.visible=false;
                                curve.open();
                            }
                        }
                    }
                    Text{
                        text:"参数修改记录";
                        y:tes.y+140;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes.y+180;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 160; height: 40;
                        Text{
                            text:"参数修改记录"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked:{
                                //head.visible=false;
                                pm_recond.open();
                                //pm_window.visible=true;
                            }
                        }
                    }
                }
                Rectangle{
                    x:455;y:0;
                    width: 445; height: 315;
                    color:"cadetblue";
                    border.color: "black";
                    border.width: 1;
                    Text{
                        text:"1#锅炉";
                        x:15;y:110;
                        color: "white"
                        font.pixelSize: 20
                    }

                    Text{
                        id:tes2;
                        text:"报表打印";
                        y:10;anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#FFFF00"
                        font.family: "KaiTi"
                        font.bold: true;
                        font.italic:true;
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes2.y+40;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"分钟报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked: {
                                minuteform.open();
                                minutewindow.visible=true;
                            }
                        }
                    }
                    Rectangle{
                        y:tes2.y+80;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"日报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked: {
                                dayform.open();
                                daywindow.visible=true;
                            }
                        }
                    }
                    Rectangle{
                        y:tes2.y+120;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"月报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked: {
                                monthform.open();
                                monthwindow.visible=true;
                            }
                        }
                    }
                    Rectangle{
                        y:tes2.y+160;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"季报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Rectangle{
                        y:tes2.y+200;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"年报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                        MouseArea{
                            anchors.fill: parent;
                            onClicked: {
                                yearform.open();
                                yearwindow.visible=true;
                            }
                        }
                    }
                }
            }
            Rectangle{
                x:0;y:315;
                width: 900; height: 315;
                color:"cadetblue";
                Rectangle{
                    x:0;y:0;
                    width: 445; height: 315;
                    color:"cadetblue";
                    border.color: "black";
                    border.width: 1;
                    Text{
                        id:tes3;
                        text:"2#锅炉";
                        x:120;y:15;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 20
                    }
                    Text{
                        text:"历史曲线";
                        y:tes3.y+25;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes3.y+65;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 160; height: 40;
                        Text{
                            text:"历史曲线查询"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Text{
                        text:"参数修改记录";
                        y:tes3.y+140;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes3.y+180;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 160; height: 40;
                        Text{
                            text:"参数修改记录"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                }
                Rectangle{
                    x:455;y:0;
                    width: 445; height: 315;
                    color:"cadetblue";
                    border.color: "black";
                    border.width: 1;
                    Text{
                        text:"2#锅炉";
                        x:15;y:110;
                        color: "white"
                        font.pixelSize: 20
                    }

                    Text{
                        id:tes4;
                        text:"报表打印";
                        y:10;anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#FFFF00"
                        font.family: "KaiTi"
                        font.bold: true;
                        font.italic:true;
                        font.pixelSize: 25
                    }
                    Rectangle{
                        y:tes4.y+40;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"分钟报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Rectangle{
                        y:tes4.y+80;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"日报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Rectangle{
                        y:tes4.y+120;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"月报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Rectangle{
                        y:tes4.y+160;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"季报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                    Rectangle{
                        y:tes4.y+200;
                        anchors.horizontalCenter: parent.horizontalCenter;
                        color: "#E6E6FA";
                        width: 140; height: 30;
                        Text{
                            text:"年报表"
                            anchors.centerIn: parent;
                            color: "black"
                            font.family: "Ubuntu"
                            font.pixelSize: 15
                        }
                    }
                }
            }
        }
    }
    Popup{
        background: Rectangle{
            width: 1280;
            height: 800;
            //color:
        }
        y:-25
        width: 1280;
        height: 800;
        id:curve
        //color:"#E0E0E0";
        Rectangle{
            id:buttonarea;
            x:400;
            y:15;
            width:850;
            height:30;
            //color:"pink";
            Text{
                id:searchmode
                text:"查询模式"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }

            ComboBox{
                height:30
                id:modeselect;
                x:searchmode.x+70
                editable: false;
                model: ["月","天","小时","分钟"];
            }

            ComboBox{
                height:30
                x:modeselect.x+70;
                id:year;
                editable: false;
                model: [2017,2015,2016,2017,2018,2019,2020];
            }
            Text{
                x:year.x+57
                text:"年"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            ComboBox{
                x:year.x+80;
                height:30
                id:month;
                editable: false;
                model:[1,2,3,4,5,6,7,8,9,10,11,12]
                currentIndex:1;

            }
            Text{
                x:month.x+57
                text:"月"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            ComboBox{
                x:month.x+80;
                height:30
                id:day;
                editable: false;
                model: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
            }
            Text{
                x:day.x+57
                text:"日"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            ComboBox{
                x:day.x+80;
                height:30
                id:hour;
                editable: false;
                model: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
            }
            Text{
                x:hour.x+57
                text:"时"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            ComboBox{
                x:hour.x+80;
                height:30
                id:minute;
                editable: false;
                model: 60
                validator: IntValidator {bottom: 0; top:59;}
            }
            Text{
                x:minute.x+57
                text:"分"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            Text{
                x:minute.x+80
                text:"查询时长"
                anchors.verticalCenter: parent.verticalCenter;
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
            ComboBox{
                x:minute.x+150
                height:30
                id:range;
                editable: false;
                model: [5,10,15,20,25,30,35,40,45,50,55,60];
            }
            Button{
                id:serch
                x:range.x+70;
                text:"查询";
                style: btnStyle;
                onClicked: {
                    draw.co(cocheck.checked);
                    draw.nox(noxcheck.checked);
                    draw.o2(o2check.checked);
                    draw.particulates(particulatescheck.checked);
                    draw.so2(so2check.checked);
                    draw.setTimeRange(range.currentText);
                    draw.setYear(year.currentText);
                    draw.setMonth(month.currentText);
                    draw.setDay(day.currentText);
                    draw.setHour(hour.currentText);
                    draw.setMinute(minute.currentText);
                    draw.modeSelect(modeselect.currentIndex);
                    //draw.setStartTime(modeselect.currentIndex);
                    //console.log(starttime);
                    //t.update();
                    draw.update();

                }
            }
            Button{
                id:quit;
                x:serch.x+80;
                text:"退出";
                style: btnStyle;
                onClicked: {
                    //head.visible=true;
                    curve.close();
                }
            }
        }
        Rectangle{
            id:context;
            x:20;
            y:50;
            width:210;
            height:530;
            color:"#E0E0E0";
            border.width:1;
            border.color: "cadetblue";
            Text{
                text:"--查询内容...";
                x:5;y:7;
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 15;
            }
        }
        Rectangle{
            id:checkarea;
            x:20;
            y:582;
            width:210;
            height:130;
            border.width:1;
            border.color: "cadetblue";
            ScrollView{
                id:scroll;
                width:210;
                height:130;
                Column{
                    x:10;
                    y:4;
                    spacing:3;
                    CheckBox{
                        text:qsTr("烟尘浓度");
                        style:boxstyle
                    }
                    CheckBox{
                        id:so2check
                        text:qsTr("SO2");
                        style:boxstyle
                    }
                    CheckBox{
                        id:noxcheck
                        text:qsTr("NOx");
                        style:boxstyle
                    }
                    CheckBox{
                        id:o2check
                        text:qsTr("O2");
                        style:boxstyle
                    }
                    CheckBox{
                        text:qsTr("温度");
                        style:boxstyle
                    }
                    CheckBox{
                        id:cocheck
                        text:qsTr("CO");
                        style:boxstyle
                    }
                    CheckBox{
                        id:particulatescheck;
                        text:qsTr("颗粒物折算值");
                        style:boxstyle
                    }
                }
            }
        }
        Rectangle{
            x:235;
            y:50;
            width:1030;
            height:40;
            color:"#E0E0E0";
            border.width: 1;
            border.color: "black";
            Rectangle{
                id:word;
                x:0;
                y:0;
                width:120;
                height:20;
                color:"#E0E0E0";
                border.width: 1;
                border.color: "black";
                Text{
                    text:"时间";
                    anchors.centerIn: parent;
                    color: "black";
                    font.family: "Ubuntu";
                    font.pixelSize: 16;
                }
            }
            Rectangle{
                id:date;
                x:0;
                y:20;
                width:120;
                height:20;
                color:"#E0E0E0";
                border.width: 1;
                border.color: "black";
                Text{
                    text:"2009-12-31 10:29:58";
                    anchors.centerIn: parent;
                    color: "black";
                    font.family: "Ubuntu";
                    font.pixelSize: 12;
                }
            }
        }
        Rectangle{
            id:display;
            x:235;
            y:92;
            width:1030;
            height:620;
            color:"#E0E0E0";
            border.width: 1;
            border.color: "gray";
            Text{
                x:30;
                y:10;
                text:"100.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35
                y:68
                text:"90.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35
                y:126
                text:"80.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35
                y:184
                text:"70.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:240;
                text:"60.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:298;
                text:"50.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:356;
                text:"40.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:414;
                text:"30.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:472;
                text:"20.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:35;y:530;
                text:"10.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            Text{
                x:40;y:588;
                text:"0.00-";
                color: "black";
                font.family: "Ubuntu";
                font.pixelSize: 13;
            }
            //            Text{
            //                //property string stime:draw.getStartTime();
            //                x:80;y:600;
            //                text:draw.getStartTime();
            //                color: "black";
            //                font.family: "Ubuntu";
            //                font.pixelSize: 13;
            //            }
            //            Text{
            //                x:980;y:600;
            //                text:"ttt";
            //                color: "black";
            //                font.family: "Ubuntu";
            //                font.pixelSize: 13;
            //            }
            Rectangle{
                id:drawwindow;
                x:80;
                y:15;
                width:932;
                height:580;
                color:"black";
                Draw{
                    id:draw
                    anchors.fill: parent
                    Component.onCompleted: {
                        co(false);
                        nox(false);
                        o2(false);
                        particulates(false);
                        so2(false);
                        draw.setYear(year.currentText);
                        draw.setMonth(month.currentText);
                        draw.setDay(day.currentText);
                        draw.setHour(hour.currentText);
                        draw.setMinute(minute.currentText);
                        //draw.setStartTime(1);
                        //stime=draw.getStartTime();
                        //setTimeRange(7);
                        //console.log("Dd");
                        //setStartTime("2017-12-12 19:22");
                        setWindowWidth(drawwindow.width);
                        setWindowHeight(drawwindow.height);
                        setMaxValue(100);
                    }
                }
            }
            //            Rectangle{
            //                x:80;
            //                y:600;
            //                width:120;
            //                height:13;
            //                color:"#E0E0E0";
            //                Text{
            //                    id:t
            //                    text:draw.getStartTime();
            //                    color: "black";
            //                    font.family: "Ubuntu";
            //                    font.pixelSize: 13;
            //                }
            //                //Component.onCompleted:{draw.update()}
            //            }
        }
        Component{
            id: btnStyle;
            ButtonStyle{
                background: Rectangle{
                    implicitWidth: 70;
                    implicitHeight: 30;
                    border.width: 1;
                    border.color: "black";
                    radius: 3;
                }
            }
        }
        Component{
            id:boxstyle
            CheckBoxStyle {
                indicator: Rectangle {
                    width: 15
                    height: 15
                    border.color: control.activeFocus ? "darkblue" : "gray"
                    border.width: 1
                    Rectangle {
                        visible: control.checked
                        color: "#555"
                        border.color: "#333"
                        radius: 1
                        anchors.margins: 3
                        anchors.fill: parent
                    }
                }
            }
        }
    }
    Popup {
        id:dayform
        Window{
            id:daywindow
            //visible: true
            width: 350
            height: 250
            title: qsTr("日报表")
            color:"#fdffef"
            Rectangle{
                //id:xuanxiang;
                x: 14
                y: 25
                ReportForm{id:report}
                width:319;height:220
                color:"#fff8f0"
                border.color: "green";
                border.width: 1;
                radius:10;
                Rectangle{
                    x: 20
                    y: -24
                    width:88;height:45
                    color:"#fff8f0";
                    Text{
                        x: 0
                        y: 16
                        text:"报表选项:";
                        color:"blue";
                    }
                }
                Rectangle{
                    anchors.horizontalCenter: parent.horizontalCenter;
                    y:50
                    height:30
                    width:200
                    color:"#fff8f0"
                    Text{
                        text:"时间选择"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }

                    TextField
                    {
                        id:day_date;
                        property string dateValue:calendar.selectedDate;
                        property string shortdate:dateValue.substr(0,10);
                        width:120
                        x:70
                        anchors.verticalCenter: parent.verticalCenter;
                        text:shortdate;
                        Button{
                            //id: downBtn
                            x: 114
                            width: 22
                            anchors.right: parent.right
                            anchors.rightMargin: 0
                            anchors.bottom: parent.bottom
                            anchors.bottomMargin: 0
                            anchors.top: parent.top
                            anchors.topMargin: 0
                            //iconSource: "../../images/arrow_down.png"
                            onClicked: {
                                cal.open();
                                calendar.visible=true;
                                //calendar.visible = !calendar.visible
                            }
                        }

                    }
                }
                Button{
                    x: 50
                    y: 120
                    width: 100
                    text:"生成"
                    onClicked: {
                        report.setFormMode(3);
                        report.setRange(6);
                        report.setDayTime(day_date.text);
                        report.report();
                        success.open();
                        s.visible=true;
                        //console.log(date01.text);
                    }
                }
                Button{
                    x: 180
                    y: 120
                    width: 100
                    text:"取消"
                    onClicked: {
                        daywindow.visible=false;
                        dayform.close();
                    }
                }
            }
        }
    }
    Popup{
        id:minuteform
        Window{
            id:minutewindow
            //visible: true
            width: 350
            height: 250
            title: qsTr("分钟报表")
            color:"#fdffef"
            Rectangle{
                //id:xuanxiang;
                x: 14
                y: 25
                //ReportForm{id:report}
                width:319;height:220
                color:"#fff8f0"
                border.color: "green";
                border.width: 1;
                radius:10;
                Rectangle{
                    x: 20
                    y: -24
                    width:88;height:45
                    color:"#fff8f0";
                    Text{
                        x: 0
                        y: 16
                        text:"报表选项:";
                        color:"blue";
                    }
                }
                Rectangle{

                    x:20
                    y:50
                    height:30
                    width:280
                    color:"#fff8f0"
                    //color:"pink"
                    Text{
                        text:"时间选择"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }
                    TextField
                    {
                        id:minute_data;
                        property string dateValue:calendar.selectedDate;
                        property string shortdate:dateValue.substr(0,10);
                        width:120
                        x:60
                        anchors.verticalCenter: parent.verticalCenter;
                        text:shortdate;
                        Button{
                            //id: downBtn
                            x: 114
                            width: 22
                            anchors.right: parent.right
                            anchors.rightMargin: 0
                            anchors.bottom: parent.bottom
                            anchors.bottomMargin: 0
                            anchors.top: parent.top
                            anchors.topMargin: 0
                            //iconSource: "../../images/arrow_down.png"
                            onClicked: {
                                cal.open();
                                calendar.visible=true;
                                //calendar.visible = !calendar.visible
                            }
                        }

                    }
                    ComboBox{
                        id:hour_choose
                        anchors.verticalCenter: parent.verticalCenter;
                        x:minute_data.x+130
                        model:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
                    }
                    Text{
                        text:"时";
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                        x:hour_choose.x+60;
                    }
                }
                Button{
                    x: 50
                    y: 120
                    width: 100
                    text:"生成"
                    onClicked: {
                        report.setFormMode(4);
                        report.setRange(7);
                        report.setMinuteTime(minute_data.text,hour_choose.currentText);
                        report.report();
                        success.open();
                        s.visible=true;
                    }
                }
                Button{
                    x: 180
                    y: 120
                    width: 100
                    text:"取消"
                    onClicked: {
                        minutewindow.visible=false;
                        minuteform.close();
                    }
                }
            }
        }
    }
    Popup{
        id:monthform
        Window{
            id:monthwindow
            //visible: true
            width: 350
            height: 250
            title: qsTr("月报表")
            color:"#fdffef"
            Rectangle{
                x: 14
                y: 25
                //ReportForm{id:report}
                width:319;height:220
                color:"#fff8f0"
                border.color: "green";
                border.width: 1;
                radius:10;
                Rectangle{
                    x: 20
                    y: -24
                    width:88;height:45
                    color:"#fff8f0";
                    Text{
                        x: 0
                        y: 16
                        text:"报表选项:";
                        color:"blue";
                    }
                }
                Rectangle{

                    //x:20
                    y:50
                    anchors.horizontalCenter: parent.horizontalCenter;
                    height:30
                    width:210
                    color:"#fff8f0"
                    //color:"pink"
                    Text{
                        text:"时间选择"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }
                    ComboBox{
                        id:year_choose
                        anchors.verticalCenter: parent.verticalCenter;
                        x:60
                        model:[2014,2015,2016,2017,2018];
                    }
                    Text{
                        x:year_choose.x+60;
                        text:"年"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }
                    ComboBox{
                        id:month_choose
                        anchors.verticalCenter: parent.verticalCenter;
                        x:year_choose.x+80
                        model:[1,2,3,4,5,6,7,8,9,10,11,12];
                    }
                    Text{
                        text:"月";
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                        x:month_choose.x+60;
                    }
                }
                Button{
                    x: 50
                    y: 120
                    width: 100
                    text:"生成"
                    onClicked: {
                        report.setFormMode(2);
                        report.setRange(5);
                        report.setMonthTime(year_choose.currentText,month_choose.currentText);
                        report.report();
                        success.open();
                        s.visible=true;
                    }
                }
                Button{
                    x: 180
                    y: 120
                    width: 100
                    text:"取消"
                    onClicked: {
                        monthwindow.visible=false;
                        monthform.close();
                    }
                }
            }
        }
    }
    Popup{
        id:yearform
        Window{
            id:yearwindow
            //visible: true
            width: 350
            height: 250
            title: qsTr("年报表")
            color:"#fdffef"
            Rectangle{
                x: 14
                y: 25
                width:319;height:220
                color:"#fff8f0"
                border.color: "green";
                border.width: 1;
                radius:10;
                Rectangle{
                    x: 20
                    y: -24
                    width:88;height:45
                    color:"#fff8f0";
                    Text{
                        x: 0
                        y: 16
                        text:"报表选项:";
                        color:"blue";
                    }
                }
                Rectangle{

                    //x:20
                    y:50
                    anchors.horizontalCenter: parent.horizontalCenter;
                    height:30
                    width:150
                    color:"#fff8f0"
                    //color:"pink"
                    Text{
                        text:"时间选择"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }
                    ComboBox{
                        id:year1
                        anchors.verticalCenter: parent.verticalCenter;
                        x:60
                        model:[2014,2015,2016,2017,2018];
                    }
                    Text{
                        x:year1.x+60;
                        text:"年"
                        font.pixelSize: 13
                        anchors.verticalCenter: parent.verticalCenter;
                    }
                }
                Button{
                    x: 50
                    y: 120
                    width: 100
                    text:"生成"
                    onClicked: {
                        report.setFormMode(1);
                        report.setRange(5);
                        report.setYearTime(year1.currentText);
                        report.report();
                        success.open();
                        s.visible=true;
                    }

                }
                Button{
                    x: 180
                    y: 120
                    width: 100
                    text:"取消"
                    onClicked: {
                        yearwindow.visible=false;
                        yearform.close();
                    }
                }
            }
        }
    }
    Popup{
        id:cal;
        Calendar{
            id: calendar
            //visible: false
            weekNumbersVisible:false;
            dayOfWeekFormat:1;
            activeFocusOnTab: true
            onReleased: {
                visible = false;
                cal.close();
            }
        }
    }
    Popup{
        id:success
        Window{
            id:s
            color:"#fff8f0"
            width: 150
            height: 100
            Text{
                anchors.centerIn: parent;
                text:"报表已生成"
                font.pixelSize: 20;
            }
        }
    }
    Popup{
        id:pm_recond;
        width: 1280;
        height: 800;
        background: Rectangle{
            width: 1280;
            height: 800;
            color:"cadetblue";
        }
        y:-25;
        Rectangle{
            //id:pm_window
            width: 1280
            height: 800
            //x:-12
            color:"cadetblue";
            Rectangle {
                x: 27
                y: 31
                height: 50
                width: 130
                color: "cadetblue"
                border.color: "black"
                border.width: 2
                Text {
                    text: "1#锅炉"
                    color: "yellow"
                    anchors.centerIn: parent
                    font.family: "Ubuntu"
                    font.pixelSize: 25
                }
                Text{
                    x: 458
                    y: 11
                    text:"用户参数修改记录"
                    color:"yellow"
                    font.family: "微软雅黑"
                    font.pixelSize: 30
                }
                Button{
                    x:1000;
                    width:100
                    height: 50
                    Text{
                        text:"退出"
                        font.pixelSize: 20;
                        anchors.centerIn: parent;
                    }
                    onClicked: {
                        //pm_window.visible=false;
                        pm_recond.close();
                        //head.visible=true;
                    }
                }

                Rectangle {
                    x: 988
                    y: 80
                    width: 200
                    height: 30
                    color: "black"
                    Text {
                        text: "2017-10-29 15:57:55"
                        anchors.centerIn: parent
                        color: "yellow"
                        font.family: "Ubuntu"
                        font.pixelSize: 15
                    }
                }
            }
            Rectangle{
                id:record
                x: 8
                y: 210
                width:1264;height:582
                color:"red";
                TableView
                {
                    id: tableView
                    anchors.fill: parent
                    model: theModel
                    TableViewColumn
                    {
                        id: checkedColumn
                        role: "xuhao"
                        title: qsTr( "序号" )
                        //delegate:styleData.value("1");
                    }

                    TableViewColumn
                    {
                        role: "shijian"
                        title: qsTr( "时间" )
                    }
                    TableViewColumn
                    {
                        role: "caozuoyuan"
                        title: qsTr( "操作员" )
                    }
                    TableViewColumn
                    {
                        role: "so2dixian"
                        title: qsTr( "SO2量程低限" )
                    }
                    TableViewColumn
                    {
                        role: "so2gaoxian"
                        title: qsTr( "SO2量程高限" )
                    }
                    TableViewColumn
                    {
                        role: "noxdixian"
                        title: qsTr( "NOX量程低限" )
                    }
                    TableViewColumn
                    {
                        role: "noxgaoxian"
                        title: qsTr( "NOX量程高限" )
                    }
                    TableViewColumn
                    {
                        role: "kelidixian"
                        title: qsTr( "颗粒物量程低限" )
                    }
                    TableViewColumn
                    {
                        role: "keligaoxian"
                        title: qsTr( "颗粒物量程高限" )
                    }
                    TableViewColumn
                    {
                        role: "o2dixian"
                        title: qsTr( "O2量程低限" )
                    }
                    TableViewColumn
                    {
                        role: "o2gaoxian"
                        title: qsTr( "O2量程高限" )
                    }
                    TableViewColumn
                    {
                        role: "codixian"
                        title: qsTr( "CO量程低限" )
                    }
                    TableViewColumn
                    {
                        role: "cogaoxian"
                        title: qsTr( "CO量程高限" )
                    }
                }
            }
            Text{
                x: 27
                y: 139
                text:"记录查询条件，从                            到"
            }
            Rectangle{
                x:174;y:128;
                width:198;height:40
                color:"white"
                TextField
                {
                    id:start_date;
                    property string dateValue:calendar01.selectedDate;
                    property string shortdate:dateValue.substr(0,10);
                    x: 0
                    y: 0
                    width: 198
                    height: 40
                    text:shortdate;
                    Calendar{
                        id: calendar01
                        x: -32
                        anchors.topMargin: 0
                        anchors.top: parent.bottom
                        visible: false
                        activeFocusOnTab: true
                        onReleased: {
                            visible = false;
                        }
                    }

                    Button{
                        x: 200
                        width: 22
                        anchors.right: parent.right
                        anchors.rightMargin: -22
                        anchors.bottom: parent.bottom
                        anchors.bottomMargin: 0
                        anchors.top: parent.top
                        anchors.topMargin: 0
                        onClicked: calendar01.visible = true;
                    }
                }
            }
            Rectangle{
                x:468;y:128;
                width:198;height:40
                color:"white"
                TextField
                {
                    id:end_date;
                    property string dateValue:calendar02.selectedDate;
                    property string shortdate:dateValue.substr(0,10);
                    x: 0
                    y: 0
                    width: 198
                    height: 40
                    text:shortdate;
                    Calendar{
                        id: calendar02
                        x: -32
                        anchors.topMargin: 0
                        anchors.top: parent.bottom
                        visible: false
                        activeFocusOnTab: true
                        onReleased: {
                            visible = false;
                        }
                    }

                    Button{
                        x: 200
                        width: 22
                        anchors.right: parent.right
                        anchors.rightMargin: -22
                        anchors.bottom: parent.bottom
                        anchors.bottomMargin: 0
                        anchors.top: parent.top
                        anchors.topMargin: 0
                        onClicked: calendar02.visible = true;
                    }
                }
            }
            Button{
                x: 712
                y: 128
                text:"查询记录"
                onClicked: {
                    theModel.setStartTime(start_date.text);
                    theModel.setEndTime(end_date.text);
                    theModel.update();
                }
            }
        }
    }
}
